﻿<%@ Page Title="" Language="C#" Theme="POSSystem" MasterPageFile="~/Application.Master"
    AutoEventWireup="true" CodeBehind="VoucherManagement.aspx.cs" Inherits="WebUI.VoucherManagement" %>

<%@ Register Src="~/Controls/SysControls/PageHeader.ascx" TagPrefix="uc" TagName="PageHeader" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<%@ Register Src="~/Controls/POSControls/VoucherListCtrl.ascx" TagPrefix="uc" TagName="VoucherList" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ApplicationHeadHolder" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ApplicationContentHolder" runat="server">
    <uc:PageHeader ID="pageHeader" Text="Voucher Management" ImageURL="~/Images/coupon_icon2.gif"
        runat="server" />
    <script type="text/javascript">
            function onRemoveVoucher() {
                var id = HasCheckedItems<%=gridVoucher.ClientID %>();
                if(id == false){
                    alert("No item was selected!");
                    return false;
                }
            
                return confirm("This action will delete all checked items. Do you want to continue?");
            }

            function showPrintDlg(key){
                var returnValue = window.showModalDialog(key, '', 'dialogWidth=800px;dialogHeight=600px;resizable=yes;help=no;unadorned=yes;');
            }
    </script>
    <table width="100%">
        <tr>
            <td style="width: 35%; text-align: left; vertical-align: top">
                <asp:Panel ID="panelProduct" runat="server" class="primaryPanel">
                    <div class="titleBar">
                        <asp:Label ID="Label4" runat="server" CssClass="titleContent">Create Voucher</asp:Label>
                    </div>
                    <div class="primaryFrameNoBorder">
                        <asp:UpdatePanel ID="updateDetails" runat="server" UpdateMode="Conditional">
                            <ContentTemplate>
                                <table>
                                    <tr>
                                        <td style="text-align: right; vertical-align: top; width: 200px">
                                            <asp:Label ID="lblName" CssClass="labelMessage" runat="server" Text="Title:"></asp:Label>
                                        </td>
                                        <td style="text-align: left; vertical-align: top">
                                            <asp:TextBox ID="txtName" Width="200px" runat="server"></asp:TextBox>
                                            <asp:RequiredFieldValidator Display="Dynamic" ValidationGroup="Save" ID="RequiredFieldValidator2"
                                                runat="server" ControlToValidate="txtName" class="requiredField" Text="required"
                                                ErrorMessage="required"></asp:RequiredFieldValidator>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="text-align: right; vertical-align: top">
                                            <asp:Label ID="Label2" runat="server" Text="Quantity:" CssClass="labelMessage"></asp:Label>
                                        </td>
                                        <td style="text-align: left; vertical-align: top">
                                            <asp:TextBox ID="txtQuantity" Width="50px" runat="server"></asp:TextBox>
                                            <cc1:FilteredTextBoxExtender ID="FilteredTextBoxExtender1" TargetControlID="txtQuantity"
                                                FilterType="Numbers" runat="server">
                                            </cc1:FilteredTextBoxExtender>
                                            <asp:RequiredFieldValidator Display="Dynamic" ValidationGroup="Save" ID="RequiredFieldValidator1"
                                                runat="server" ControlToValidate="txtQuantity" class="requiredField" Text="required"
                                                ErrorMessage="required"></asp:RequiredFieldValidator>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="text-align: right; vertical-align: top">
                                            <asp:Label ID="Label1" runat="server" Text="Expiration Date:" CssClass="labelMessage"></asp:Label>
                                        </td>
                                        <td style="text-align: left; vertical-align: top">
                                            <asp:TextBox Width="80px" ID="txtExpirationDate" runat="server"></asp:TextBox>
                                            <cc1:CalendarExtender ID="calExpirationDate" TargetControlID="txtExpirationDate"
                                                runat="server" Format="dd MMM yyyy">
                                            </cc1:CalendarExtender>
                                            <asp:RequiredFieldValidator Display="Dynamic" ValidationGroup="Save" ID="RequiredFieldValidator3"
                                                runat="server" ControlToValidate="txtExpirationDate" class="requiredField" Text="required"
                                                ErrorMessage="required"></asp:RequiredFieldValidator>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="text-align: right; vertical-align: top">
                                            <asp:Label ID="Label5" runat="server" Text="Discount:" CssClass="labelMessage"></asp:Label>
                                        </td>
                                        <td style="text-align: left; vertical-align: top">
                                            <asp:RadioButton Checked="true" ID="rdPercent" runat="server" GroupName="discount" />
                                            <asp:TextBox onfocus='this.select();' Width="50px" ID="txtDiscountPer" runat="server">0</asp:TextBox>
                                            <span style='margin-right: 10px' class="labelMessage">%</span>
                                            <asp:RadioButton ID="rdAmount" runat="server" GroupName="discount" />
                                            <asp:TextBox onfocus='this.select();' Width="50px" ID="txtDisAmount" runat="server">0</asp:TextBox>
                                            <span style='margin-right: 10px' class="labelMessage">$</span>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="text-align: right; vertical-align: top">
                                            <asp:Label ID="Label12" runat="server" Text="Use Mode:" CssClass="labelMessage"></asp:Label>
                                        </td>
                                        <td style="text-align: left; vertical-align: top">
                                            <asp:RadioButton GroupName="UseMode" ID="rdSingle" runat="server" Text="Single" Checked="true" />
                                            <asp:RadioButton GroupName="UseMode" ID="rdMulti" runat="server" Text="Until Expired" />
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="text-align: right; vertical-align: top">
                                            <asp:Label ID="Label3" runat="server" Text="Auto Print After Create:" CssClass="labelMessage"></asp:Label>
                                        </td>
                                        <td style="text-align: left; vertical-align: top">
                                            <asp:CheckBox ID="chkPrint" runat="server" Checked="true" />
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="text-align: right; vertical-align: top">
                                        </td>
                                        <td style="text-align: left; vertical-align: top">
                                            <asp:Button ID="btnCreate" ValidationGroup="Save" runat="server" Text="Create" OnClick="btnCreate_OnClick" />
                                            <asp:Button ID="btnClear" runat="server" Text="Clear" OnClick="btnClear_OnClick" />
                                        </td>
                                    </tr>
                                </table>
                                <br />
                                <asp:Panel ID="panelLLookUp" runat="server">
                                </asp:Panel>
                            </ContentTemplate>
                        </asp:UpdatePanel>
                    </div>
                </asp:Panel>
            </td>
            <td style="width: 65%; text-align: left; vertical-align: top">
                <asp:Panel ID="panel2" runat="server" class="primaryPanel">
                    <div class="titleBar">
                        <asp:Label ID="Label6" runat="server" CssClass="titleContent">Voucher Lookup</asp:Label>
                    </div>
                    <div class="primaryFrameNoBorder" style='min-height: 400px'>
                        <asp:UpdatePanel ID="updateLookUp" runat="server" UpdateMode="Conditional">
                            <ContentTemplate>
                                <div style='text-align: center; margin: auto'>
                                    <asp:Panel ID="panel" runat="server" DefaultButton="btnLookup">
                                        <table style='margin: auto'>
                                            <tr>
                                                <td style='text-align: right'>
                                                    <asp:Label CssClass='labelMessage' ID='lblVoucherCode' runat="server">Voucher Title/Code:</asp:Label>
                                                </td>
                                                <td style='text-align: left' colspan="5">
                                                    <asp:TextBox Width="99%" ID="txtVoucherCode" runat="server"></asp:TextBox>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td style='text-align: right'>
                                                    <asp:Label CssClass='labelMessage' ID='Label8' runat="server">Used:</asp:Label>
                                                </td>
                                                <td style='text-align: left'>
                                                    <asp:DropDownList ID="ddlIsUsed" runat="server">
                                                        <asp:ListItem Text="Both" Value=""></asp:ListItem>
                                                        <asp:ListItem Text="Yes" Value="1"></asp:ListItem>
                                                        <asp:ListItem Text="No" Value="0"></asp:ListItem>
                                                    </asp:DropDownList>
                                                </td>
                                                <td style='text-align: right'>
                                                    <asp:Label CssClass='labelMessage' ID='Label11' runat="server">Enabled:</asp:Label>
                                                </td>
                                                <td style='text-align: left'>
                                                    <asp:DropDownList ID="ddlEnable" runat="server">
                                                        <asp:ListItem Text="Both" Value=""></asp:ListItem>
                                                        <asp:ListItem Text="Yes" Value="1"></asp:ListItem>
                                                        <asp:ListItem Text="No" Value="0"></asp:ListItem>
                                                    </asp:DropDownList>
                                                </td>
                                                <td style='text-align: right'>
                                                    <asp:Label CssClass='labelMessage' ID='Label7' runat="server">Expired:</asp:Label>
                                                </td>
                                                <td style='text-align: left'>
                                                    <asp:DropDownList ID="ddlExpired" runat="server">
                                                        <asp:ListItem Text="Both" Value=""></asp:ListItem>
                                                        <asp:ListItem Text="Yes" Value="1"></asp:ListItem>
                                                        <asp:ListItem Text="No" Value="0"></asp:ListItem>
                                                    </asp:DropDownList>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td style='text-align: right'>
                                                </td>
                                                <td style='text-align: left' colspan="5">
                                                    <asp:Button ID="btnLookup" runat="server" Text="Look Up" OnClick="btnLookup_OnClick" />
                                                </td>
                                            </tr>
                                        </table>
                                    </asp:Panel>
                                    <div style='height: 10px'>
                                        &nbsp;
                                    </div>
                                    <table width="100%" class="toolbar">
                                        <tr>
                                            <td style='vertical-align: middle'>
                                                <asp:LinkButton class="tbbutton" ID="btnDeleteVoucher" runat="server" OnClientClick="return onRemoveVoucher();"
                                                    OnClick="btnRemoveVoucher_OnClick">
                                                    <img src="Images/Delete.gif" /><asp:Label ID="label9" runat="server" Text="Delete"></asp:Label>
                                                </asp:LinkButton>
                                                <img src="Images/tbSep.png" />
                                                <asp:LinkButton class="tbbutton" ID="btnPrintVoucher" runat="server" OnClick="btnPrintVoucher_OnClick">
                                                    <img src="Images/print.gif" /><asp:Label ID="label10" runat="server" Text="Print"></asp:Label>
                                                </asp:LinkButton>
                                            </td>
                                        </tr>
                                    </table>
                                    <uc:VoucherList ID="gridVoucher" OnProductNameClick="gridVoucher_OnProductNameClick" ShowFooter="false" Width="100%" runat="server" AllowPaging="true"
                                        AllowSorting="true" AllowSelecting="true" SaveOnCommit="false" />
                                </div>
                            </ContentTemplate>
                        </asp:UpdatePanel>
                    </div>
                </asp:Panel>
            </td>
        </tr>
    </table>
</asp:Content>
